﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MadLibrary.Collections;

namespace MadLibrary.Web
{
    /// <summary>
    /// Holds and manages CSS styles.
    /// </summary>
    public class CssStyles : Collection<CssStyle>, IBuildable
    {
        /// <summary>
        /// Creates new empty CSS style collection.
        /// </summary>
        public CssStyles()
            : base()
        {
        }

        /// <summary>
        /// Creates new CSS style collection with specified CSS styles.
        /// </summary>
        /// <param name="Styles">Specifies styles which has to be defaultly added into new collection.</param>
        public CssStyles(params CssStyle[] Styles)
            : base(Styles)
        {
        }

        /// <summary>
        /// Generates refactorized string form of all CSS styles in current CSS style collection.
        /// </summary>
        /// <returns>String of all CSS styles in current CSS style collection.</returns>
        string IBuildable.Build()
        {
            string ret = "";
            foreach(CssStyle style in this.data)
            {
                ret += (style as IBuildable).Build();
            }
            return ret;
        }
    }
}